<?php defined('SYSPATH') or die('No direct access allowed.');

	class Model_SegmentParameter extends Model{
		
		public $startCoordPoint = array("x1"=>"","y1"=>"");
		public $endCoordPoint = array("x2"=>"","y2"=>"");
		public $value = 0;
		
		public function setValue($val){
			$this->value = $val;
		}
		
		public function setStartPoint($x1, $y1){
			$this->startCoordPoint["x1"] = $x1;
			$this->startCoordPoint["y1"] = $y1; 
		}
		
		public function setEndPoint($x2, $y2){
			$this->endCoordPoint["x2"] = $x2;
			$this->endCoordPoint["y2"] = $y2;
		}
		
		public function toJSON(){
			$json = '[';
			$json.= '['.round(floatval($this->startCoordPoint["x1"]),5).','.round(floatval($this->startCoordPoint["y1"]),5).'],';
			$json.= '['.round(floatval($this->endCoordPoint["x2"]),5).','.round(floatval($this->endCoordPoint["y2"]),5).']';
			$json.= ']';
			return $json;
		}
	}
?>


